<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>layout 后台</title>
    <link rel="stylesheet" href="layui/css/layui.css">
    <style type="text/css">
        .layui-content {
            display: none;
        }

        .layui-content.active {
            display: block;
        }
        #dialog{
            display: none;
            width: 100%;
        }
        #dialog .layui-input-block{
            width: 300px;
        }
    </style>
</head>

<body class="layui-layout-body">
    <div class="layui-layout layui-layout-admin">
        <div class="layui-header">
            <div class="layui-logo">layui 后台</div>
            <!-- 头部区域（可配合layui已有的水平导航） -->
            <ul class="layui-nav layui-layout-left" lay-filter="nav">
                <li class="layui-nav-item layui-this"><a href="#form">表单</a></li>
                <li class="layui-nav-item"><a href="#table">表格</a></li>
                <li class="layui-nav-item">
                    <a href="javascript:;">其它系统</a>
                    <dl class="layui-nav-child">
                        <dd><a href="">邮件管理</a></dd>
                        <dd><a href="">消息管理</a></dd>
                        <dd><a href="">授权管理</a></dd>
                    </dl>
                </li>
            </ul>
            <ul class="layui-nav layui-layout-right">
                <li class="layui-nav-item">
                    <a href="javascript:;">
                        <img src="http://t.cn/RCzsdCq" class="layui-nav-img">
                        贤心
                    </a>
                    <dl class="layui-nav-child">
                        <dd><a href="">基本资料</a></dd>
                        <dd><a href="">安全设置</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item"><a href="">退了</a></li>
            </ul>
        </div>

        <div class="layui-side layui-bg-black">
            <div class="layui-side-scroll">
                <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
                <ul class="layui-nav layui-nav-tree" lay-filter="test">
                    <li class="layui-nav-item layui-nav-itemed">
                        <a class="" href="javascript:;">所有商品</a>
                        <dl class="layui-nav-child">
                            <dd><a href="javascript:;">列表一</a></dd>
                            <dd><a href="javascript:;">列表二</a></dd>
                            <dd><a href="javascript:;">列表三</a></dd>
                            <dd><a href="">超链接</a></dd>
                        </dl>
                    </li>
                    <li class="layui-nav-item">
                        <a href="javascript:;">解决方案</a>
                        <dl class="layui-nav-child">
                            <dd><a href="javascript:;">列表一</a></dd>
                            <dd><a href="javascript:;">列表二</a></dd>
                            <dd><a href="">超链接</a></dd>
                        </dl>
                    </li>
                    <li class="layui-nav-item"><a href="">云市场</a></li>
                    <li class="layui-nav-item"><a href="">发布商品</a></li>
                </ul>
            </div>
        </div>

        <div class="layui-body">
            <!-- 内容主体区域 -->
            <div style="padding: 15px;">
                <div class="form layui-content active" id="form">
                    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                        <legend>表单集合演示</legend>
                    </fieldset>

                    <form class="layui-form" action="">
                        <div class="layui-form-item">
                            <label class="layui-form-label">单行输入框</label>
                            <div class="layui-input-block">
                                <input type="text" name="title" lay-verify="title" autocomplete="off"
                                    placeholder="请输入标题" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">验证必填项</label>
                            <div class="layui-input-block">
                                <input type="text" name="username" lay-verify="required" lay-reqtext="用户名是必填项，岂能为空？"
                                    placeholder="请输入" autocomplete="off" class="layui-input">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">验证手机</label>
                                <div class="layui-input-inline">
                                    <input type="tel" name="phone" lay-verify="required|phone" autocomplete="off"
                                        class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">验证邮箱</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="email" lay-verify="email" autocomplete="off"
                                        class="layui-input">
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">多规则验证</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="number" lay-verify="required|number" autocomplete="off"
                                        class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">验证日期</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="date" id="date" lay-verify="date" placeholder="yyyy-MM-dd"
                                        autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">验证链接</label>
                                <div class="layui-input-inline">
                                    <input type="tel" name="url" lay-verify="url" autocomplete="off"
                                        class="layui-input">
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">验证身份证</label>
                            <div class="layui-input-block">
                                <input type="text" name="identity" lay-verify="identity" placeholder=""
                                    autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">自定义验证</label>
                            <div class="layui-input-inline">
                                <input type="password" name="password" lay-verify="pass" placeholder="请输入密码"
                                    autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">请填写6到12位密码</div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">范围</label>
                                <div class="layui-input-inline" style="width: 100px;">
                                    <input type="text" name="price_min" placeholder="￥" autocomplete="off"
                                        class="layui-input">
                                </div>
                                <div class="layui-form-mid">-</div>
                                <div class="layui-input-inline" style="width: 100px;">
                                    <input type="text" name="price_max" placeholder="￥" autocomplete="off"
                                        class="layui-input">
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">单行选择框</label>
                            <div class="layui-input-block">
                                <select name="interest" lay-filter="aihao">
                                    <option value=""></option>
                                    <option value="0">写作</option>
                                    <option value="1" selected="">阅读</option>
                                    <option value="2">游戏</option>
                                    <option value="3">音乐</option>
                                    <option value="4">旅行</option>
                                </select>
                            </div>
                        </div>


                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">分组选择框</label>
                                <div class="layui-input-inline">
                                    <select name="quiz">
                                        <option value="">请选择问题</option>
                                        <optgroup label="城市记忆">
                                            <option value="你工作的第一个城市">你工作的第一个城市</option>
                                        </optgroup>
                                        <optgroup label="学生时代">
                                            <option value="你的工号">你的工号</option>
                                            <option value="你最喜欢的老师">你最喜欢的老师</option>
                                        </optgroup>
                                    </select>
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">搜索选择框</label>
                                <div class="layui-input-inline">
                                    <select name="modules" lay-verify="required" lay-search="">
                                        <option value="">直接选择或搜索选择</option>
                                        <option value="1">layer</option>
                                        <option value="2">form</option>
                                        <option value="3">layim</option>
                                        <option value="4">element</option>
                                        <option value="5">laytpl</option>
                                        <option value="6">upload</option>
                                        <option value="7">laydate</option>
                                        <option value="8">laypage</option>
                                        <option value="9">flow</option>
                                        <option value="10">util</option>
                                        <option value="11">code</option>
                                        <option value="12">tree</option>
                                        <option value="13">layedit</option>
                                        <option value="14">nav</option>
                                        <option value="15">tab</option>
                                        <option value="16">table</option>
                                        <option value="17">select</option>
                                        <option value="18">checkbox</option>
                                        <option value="19">switch</option>
                                        <option value="20">radio</option>
                                    </select>
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">联动选择框</label>
                            <div class="layui-input-inline">
                                <select name="quiz1">
                                    <option value="">请选择省</option>
                                    <option value="浙江" selected="">浙江省</option>
                                    <option value="你的工号">江西省</option>
                                    <option value="你最喜欢的老师">福建省</option>
                                </select>
                            </div>
                            <div class="layui-input-inline">
                                <select name="quiz2">
                                    <option value="">请选择市</option>
                                    <option value="杭州">杭州</option>
                                    <option value="宁波" disabled="">宁波</option>
                                    <option value="温州">温州</option>
                                    <option value="温州">台州</option>
                                    <option value="温州">绍兴</option>
                                </select>
                            </div>
                            <div class="layui-input-inline">
                                <select name="quiz3">
                                    <option value="">请选择县/区</option>
                                    <option value="西湖区">西湖区</option>
                                    <option value="余杭区">余杭区</option>
                                    <option value="拱墅区">临安市</option>
                                </select>
                            </div>
                            <div class="layui-form-mid layui-word-aux">此处只是演示联动排版，并未做联动交互</div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">复选框</label>
                            <div class="layui-input-block">
                                <input type="checkbox" name="like[write]" title="写作">
                                <input type="checkbox" name="like[read]" title="阅读" checked="">
                                <input type="checkbox" name="like[game]" title="游戏">
                            </div>
                        </div>

                        <div class="layui-form-item" pane="">
                            <label class="layui-form-label">原始复选框</label>
                            <div class="layui-input-block">
                                <input type="checkbox" name="like1[write]" lay-skin="primary" title="写作" checked="">
                                <input type="checkbox" name="like1[read]" lay-skin="primary" title="阅读">
                                <input type="checkbox" name="like1[game]" lay-skin="primary" title="游戏" disabled="">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">开关-默认关</label>
                            <div class="layui-input-block">
                                <input type="checkbox" name="close" lay-skin="switch" lay-text="ON|OFF">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">开关-默认开</label>
                            <div class="layui-input-block">
                                <input type="checkbox" checked="" name="open" lay-skin="switch" lay-filter="switchTest"
                                    lay-text="ON|OFF">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">单选框</label>
                            <div class="layui-input-block">
                                <input type="radio" name="sex" value="男" title="男" checked="">
                                <input type="radio" name="sex" value="女" title="女">
                                <input type="radio" name="sex" value="禁" title="禁用" disabled="">
                            </div>
                        </div>
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">普通文本域</label>
                            <div class="layui-input-block">
                                <textarea placeholder="请输入内容" class="layui-textarea"></textarea>
                            </div>
                        </div>
                        <!--<div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">编辑器</label>
                        <div class="layui-input-block">
                            <textarea class="layui-textarea layui-hide" name="content" lay-verify="content" id="LAY_demo_editor"></textarea>
                        </div>
                        </div>-->
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                        </div>
                    </form>

                    <!-- 示例-970 -->
                    <ins class="adsbygoogle" style="display:inline-block;width:970px;height:90px"
                        data-ad-client="ca-pub-6111334333458862" data-ad-slot="3820120620"></ins>

                    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
                        <legend>赋值和取值</legend>
                    </fieldset>

                    <form class="layui-form" action="" lay-filter="example">
                        <div class="layui-form-item">
                            <label class="layui-form-label">输入框</label>
                            <div class="layui-input-block">
                                <input type="text" name="username" lay-verify="title" autocomplete="off"
                                    placeholder="请输入标题" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">密码框</label>
                            <div class="layui-input-block">
                                <input type="password" name="password" placeholder="请输入密码" autocomplete="off"
                                    class="layui-input">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">选择框</label>
                            <div class="layui-input-block">
                                <select name="interest" lay-filter="aihao">
                                    <option value=""></option>
                                    <option value="0">写作</option>
                                    <option value="1">阅读</option>
                                    <option value="2">游戏</option>
                                    <option value="3">音乐</option>
                                    <option value="4">旅行</option>
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">复选框</label>
                            <div class="layui-input-block">
                                <input type="checkbox" name="like[write]" title="写作">
                                <input type="checkbox" name="like[read]" title="阅读">
                                <input type="checkbox" name="like[daze]" title="发呆">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">开关</label>
                            <div class="layui-input-block">
                                <input type="checkbox" name="close" lay-skin="switch" lay-text="ON|OFF">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">单选框</label>
                            <div class="layui-input-block">
                                <input type="radio" name="sex" value="男" title="男" checked="">
                                <input type="radio" name="sex" value="女" title="女">
                            </div>
                        </div>
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">文本域</label>
                            <div class="layui-input-block">
                                <textarea placeholder="请输入内容" class="layui-textarea" name="desc"></textarea>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button type="button" class="layui-btn layui-btn-normal"
                                    id="LAY-component-form-setval">赋值</button>
                                <button type="button" class="layui-btn layui-btn-normal"
                                    id="LAY-component-form-getval">取值</button>
                                <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
                            </div>
                        </div>
                    </form>
                    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
                        <legend>方框风格的表单集合</legend>
                    </fieldset>
                    <form class="layui-form layui-form-pane" action="">
                        <div class="layui-form-item">
                            <label class="layui-form-label">长输入框</label>
                            <div class="layui-input-block">
                                <input type="text" name="title" autocomplete="off" placeholder="请输入标题"
                                    class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">短输入框</label>
                            <div class="layui-input-inline">
                                <input type="text" name="username" lay-verify="required" placeholder="请输入"
                                    autocomplete="off" class="layui-input">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">日期选择</label>
                                <div class="layui-input-block">
                                    <input type="text" name="date" id="date1" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">行内表单</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="number" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">密码</label>
                            <div class="layui-input-inline">
                                <input type="password" name="password" placeholder="请输入密码" autocomplete="off"
                                    class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">请务必填写用户名</div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">范围</label>
                                <div class="layui-input-inline" style="width: 100px;">
                                    <input type="text" name="price_min" placeholder="￥" autocomplete="off"
                                        class="layui-input">
                                </div>
                                <div class="layui-form-mid">-</div>
                                <div class="layui-input-inline" style="width: 100px;">
                                    <input type="text" name="price_max" placeholder="￥" autocomplete="off"
                                        class="layui-input">
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">单行选择框</label>
                            <div class="layui-input-block">
                                <select name="interest" lay-filter="aihao">
                                    <option value=""></option>
                                    <option value="0">写作</option>
                                    <option value="1" selected="">阅读</option>
                                    <option value="2">游戏</option>
                                    <option value="3">音乐</option>
                                    <option value="4">旅行</option>
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">行内选择框</label>
                            <div class="layui-input-inline">
                                <select name="quiz1">
                                    <option value="">请选择省</option>
                                    <option value="浙江" selected="">浙江省</option>
                                    <option value="你的工号">江西省</option>
                                    <option value="你最喜欢的老师">福建省</option>
                                </select>
                            </div>
                            <div class="layui-input-inline">
                                <select name="quiz2">
                                    <option value="">请选择市</option>
                                    <option value="杭州">杭州</option>
                                    <option value="宁波" disabled="">宁波</option>
                                    <option value="温州">温州</option>
                                    <option value="温州">台州</option>
                                    <option value="温州">绍兴</option>
                                </select>
                            </div>
                            <div class="layui-input-inline">
                                <select name="quiz3">
                                    <option value="">请选择县/区</option>
                                    <option value="西湖区">西湖区</option>
                                    <option value="余杭区">余杭区</option>
                                    <option value="拱墅区">临安市</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item" pane="">
                            <label class="layui-form-label">开关-开</label>
                            <div class="layui-input-block">
                                <input type="checkbox" checked="" name="open" lay-skin="switch" lay-filter="switchTest"
                                    title="开关">
                            </div>
                        </div>
                        <div class="layui-form-item" pane="">
                            <label class="layui-form-label">单选框</label>
                            <div class="layui-input-block">
                                <input type="radio" name="sex" value="男" title="男" checked="">
                                <input type="radio" name="sex" value="女" title="女">
                                <input type="radio" name="sex" value="禁" title="禁用" disabled="">
                            </div>
                        </div>
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">文本域</label>
                            <div class="layui-input-block">
                                <textarea placeholder="请输入内容" class="layui-textarea"></textarea>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <button class="layui-btn" lay-submit="" lay-filter="demo2">跳转式提交</button>
                        </div>
                    </form>
                </div>
                <div class="table layui-content" id="table">
                    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                        <legend>表格</legend>
                    </fieldset>
                    <table class="layui-hide" id="tableDemo" lay-filter="tableDemo">
                    </table>
                </div>
                <script type="text/html" id="barDemo">
                    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
                    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
                    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
                </script>
            </div>

        </div>

        <div class="layui-footer">
            <!-- 底部固定区域 -->
            底部栏
        </div>
    </div>
    <!-- 弹窗 -->
    <div id="dialog">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
            <legend>弹窗</legend>
        </fieldset>
        <form class="layui-form" action="" lay-filter="example">
            <div class="layui-form-item">
                <label class="layui-form-label">输入框</label>
                <div class="layui-input-block">
                    <input type="text" name="username" lay-verify="title" autocomplete="off"
                        placeholder="请输入标题" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">密码框</label>
                <div class="layui-input-block">
                    <input type="password" name="password" placeholder="请输入密码" autocomplete="off"
                        class="layui-input">
                </div>
            </div>
        </form>
    </div>
    <script src="layui/layui.js" type="text/javascript"></script>
    <script src="js/jquery.js" type="text/javascript"></script>
    <script>
        //JavaScript代码区域
        layui.use('element', function () {
            var element = layui.element;

            layui.use('table', function () {
                var table = layui.table;
                let data = '{"data":[{"id":10000,"username":"user-0","sex":"女","city":"城市-0","sign":"签名-0","experience":255,"logins":24,"wealth":82830700,"classify":"作家","score":57},{"id":10001,"username":"user-1","sex":"男","city":"城市-1","sign":"签名-1","experience":884,"logins":58,"wealth":64928690,"classify":"词人","score":27},{"id":10002,"username":"user-2","sex":"女","city":"城市-2","sign":"签名-2","experience":650,"logins":77,"wealth":6298078,"classify":"酱油","score":31},{"id":10003,"username":"user-3","sex":"女","city":"城市-3","sign":"签名-3","experience":362,"logins":157,"wealth":37117017,"classify":"诗人","score":68},{"id":10004,"username":"user-4","sex":"男","city":"城市-4","sign":"签名-4","experience":807,"logins":51,"wealth":76263262,"classify":"作家","score":6},{"id":10005,"username":"user-5","sex":"女","city":"城市-5","sign":"签名-5","experience":173,"logins":68,"wealth":60344147,"classify":"作家","score":87},{"id":10006,"username":"user-6","sex":"女","city":"城市-6","sign":"签名-6","experience":982,"logins":37,"wealth":57768166,"classify":"作家","score":34},{"id":10007,"username":"user-7","sex":"男","city":"城市-7","sign":"签名-7","experience":727,"logins":150,"wealth":82030578,"classify":"作家","score":28},{"id":10008,"username":"user-8","sex":"男","city":"城市-8","sign":"签名-8","experience":951,"logins":133,"wealth":16503371,"classify":"词人","score":14},{"id":10009,"username":"user-9","sex":"女","city":"城市-9","sign":"签名-9","experience":484,"logins":25,"wealth":86801934,"classify":"词人","score":75}]}'
                data = JSON.parse(data).data;
                table.render({
                    elem: '#tableDemo'
                    , cols: [[
                        { type: 'checkbox' }
                        , { field: 'id', width: 80, title: 'ID', sort: true }
                        , { field: 'username', width: 80, title: '用户名' }
                        , { field: 'sex', width: 80, title: '性别', sort: true }
                        , { field: 'city', width: 80, title: '城市' }
                        , { field: 'sign', title: '签名', minWidth: 80 }
                        , { field: 'experience', width: 80, title: '积分', sort: true }
                        , { field: 'score', width: 80, title: '评分', sort: true }
                        , { field: 'classify', width: 80, title: '职业' }
                        , { field: 'wealth', width: 80, title: '财富', sort: true }
                        , { fixed: 'right', title: '操作', toolbar: '#barDemo', width: 200 }
                    ]],
                    data: data
                    , page: true
                    , toolbar: true
                });
                //监听工具条
                table.on('tool(tableDemo)', function (obj) {
                    var data = obj.data;
                    if (obj.event === 'detail') {
                        // layer.msg('ID：'+ data.id + ' 的查看操作');
                        layer.open({
                            type: 1,
                            title: '弹窗',
                            shadeClose: true,
                            content: $('#dialog'),
                            area: ['500px', '400px'],
                            btn: ['取消','确定'] //按钮
                        });
                    } else if (obj.event === 'del') {
                        layer.confirm('真的删除行么', function (index) {
                            obj.del();
                            layer.close(index);
                        });
                    } else if (obj.event === 'edit') {
                        layer.alert('编辑行：<br>' + JSON.stringify(data))
                    }
                });
            });
            //监听导航点击
            element.on('nav(nav)', function (elem) {
                //console.log(elem)
                $('.layui-content').removeClass('active');
                $(elem.attr('href')).addClass('active')
            });
        });
    </script>
</body>

</html>